//
//  SEPrescriptionDrugsNewCell.swift
//  SmartEyeForDoctor
//
//  Created by QDSG on 2021/5/13.
//

import UIKit

class SEPrescriptionDrugsNewCell: UITableViewCell {
    
    weak var delegate: SEPrescriptionNewCellDelegate?

    func update(with viewModel: SEPrescriptionViewModel, editEnable: Bool) {
        deleteButton.isHidden = !editEnable
        nameLabel.text = viewModel.drug.name
        numberLabel.text = viewModel.drug.drugNumber
        priceLabel.text = viewModel.totalPrice
        frequencyLabel.text = viewModel.drug.drugFrequency
        dosageLabel.text = viewModel.drug.drugDose
        usingLabel.text = viewModel.drug.drugUsing
    }
    
    @IBAction private func deleteAction() {
        delegate?.drugsNewCell(didTappedDelete: self)
    }
    
    @IBOutlet private weak var nameLabel: UILabel!
    @IBOutlet private weak var numberLabel: UILabel!
    @IBOutlet private weak var priceLabel: UILabel!
    
    @IBOutlet private weak var frequencyLabel: UILabel!
    @IBOutlet private weak var dosageLabel: UILabel!
    @IBOutlet private weak var usingLabel: UILabel!
    
    @IBOutlet private weak var deleteButton: UIButton!
}
